package xworker.netty.handlers.http;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class HttpHandlerInfo {
    RequestMapping requestMapping;
    Method method;
    Object object;

    public HttpHandlerInfo(RequestMapping requestMapping, Method method, Object object){
        this.requestMapping = requestMapping;
        this.method = method;
        this.object = object;
    }

    public boolean accept(String url){
        return url.matches(requestMapping.contextPath());
    }

    public Object handleRquest() throws InvocationTargetException, IllegalAccessException {
        return method.invoke(object);
    }
}
